//
//  ViewController.m
//  test
//
//  Created by Vincent on 2017/3/25.
//  Copyright © 2017年 Vincent. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()



@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    NSString *tm = @"test";
    NSAttributedString *att = [[NSAttributedString alloc] initWithString:tm attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:50],NSForegroundColorAttributeName:[UIColor blueColor]}];
    
    CATextLayer *txtLayer = [CATextLayer layer];
    txtLayer.bounds = CGRectMake(0, 0,300, 300);
    txtLayer.position=self.view.center;
    txtLayer.backgroundColor=[UIColor redColor].CGColor;
    txtLayer.contentsScale = [UIScreen mainScreen].scale;
    txtLayer.string = att;
    txtLayer.alignmentMode = kCAAlignmentCenter;
    
   
    [self.view.layer addSublayer:txtLayer];
    
   
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
